<style>    
    #testFileInput2{
        height: 30px; width: 102px; margin-left: 128px;
    }
    #preview1, #topPhpto
        {  
            width:150px;  
            padding-left: 65px;padding-top: 15px; border-top-width: 5px;
            //height:150px;  
        }
</style>
<div class="pageContent">	
    <form method="post" action="__CONTROLLER__/edit_?callbackType=closeCurrent" id="myForm" class="pageForm required-validate" onsubmit="return validateCallback(this, dialogAjaxDone)">        
        <div class="pageFormContent" layoutH="58">            
            <input type="hidden" name="kpi_id" value="<{$kpi_id}>"/>
            <input type="hidden" name="db" value="KpiTasks"/>
            <for start="1" end="11">    
                <div class="unit">
                    <label>项目<{$i}>：</label>
                    <input type="text" size="25" name='subjects<{$i}>'  value="" <eq name="i" value="1">class="required"</eq>/>
                </div>
                <div class="unit">
                    <label>计划完成日期：</label>
                    <input type="text" size="25" name='completion_data<{$i}>'  value="" readonly='true' class="date"/>
                </div>
                <div class="unit">
                    <label>实际完成日期：</label>
                    <input type="text" size="25" name='actual_completion_data<{$i}>'  value="" readonly='true' class="date"/>
                </div>
                <div class="unit">
                    <label>权重：</label>
                    <input type="text" size="25" class="percentage" name='percentage<{$i}>'  value="" <eq name="i" value="1">class="required"</eq>/>
                </div>
                <div class="unit">
                    <label>项目描述：</label>
                    <textarea name="modification_record<{$i}>" rows="5" cols="53" <eq name="i" value="1">class="required"</eq>></textarea>
                </div>
                <p></p>
            </for>
        </div>
        <div class="formBar">
            <ul>
                <li><div class="buttonActive"><div class="buttonContent"><button type="button" id='sub'>提交</button></div></div></li>
                <li><div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div></li>
            </ul>
        </div>
    </form>	
</div>
<script>
    $(function(){
        $("#sub").click(function(){
            var kpi_id  =$("input[name='kpi_id']").val();
            var count    =new Array();
            for(i=1;i<=$(".percentage").length;i++){                
                if($("input[name='percentage"+i+"']").val()){
                    count[i]=parseInt($("input[name='percentage"+i+"']").val());
                }
            }
            var count_  =eval(count.join('+'));
            
            $.post("__CONTROLLER__/ajaxCount",{kpi_id:kpi_id,count_:count_},function(data){
                if(data==2){
                    alert("所有权重相加必须为100%");
                    return false;
                }else if(data==1){
                    $("#myForm").submit();
                }
            });
            
            
            
            
            
            /*
            if(eval(count.join('+'))!=100){
                alert("权重相加必须为100%");
                return false;
            }
            $.post("__CONTROLLER__/ajaxIs_set",{username:username,quarter:quarter},function(data){
                if(data==1){
                    alert("该用户本季度考核已经存在");
                    return false;
                }else if(data==2){
                    $("#myForm").submit();
                }
            });
            */
        });
    });
    
</script>
